{extend name="$_theme_public_layout"/}
{block name="style"}
<style type="text/css">

</style>
{/block}

{block name="main"}
<div class="conten_body">
    <h4>
        最新文章
    </h4>
    <div class="list">
        {php}
            use app\cms\model\Posts as PostsModel;
            $map['status'] = 1;
            $map['type'] = 'post';
            $post_list = PostsModel::where($map)->order('sort desc,create_time desc,id desc')->paginate(5);
        {/php}
        {volist name="post_list" id="data"}
            <article>
                <h1>
                    <a href="{:url('cms/index/detail',['id'=>$data['id']])}">
                        {$data.title}
                    </a>
                </h1>
                <div class="des">
                    {$data.digest}
                </div>
                <div class="img">
                    <a href="{:url('cms/index/detail',['id'=>$data['id']])}">
                        <img src="{$data.cover}" alt="{$data.title}">
                    </a>
                </div>
            </article>
        {/volist}

    </div>
</div>

<div class="sidebar">
    <ul>
        <li>
            <h4>
                最新发表
            </h4>
            <ul>
                {volist name="post_list" id="data"}
                    <li>
                        <a href="{:url('cms/index/detail',['id'=>$data['id']])}">
                            {$data.title}
                        </a>
                    </li>
                {/volist}
            </ul>
        </li>
        <li>
            <h4>
                标签
            </h4>
            {php}
                use app\cms\logic\Tag as TagLogic;
                $tag_list = TagLogic::getTags()
            {/php}
            <div class="post_tags">
                {volist name="tag_list" id="tag"}
                    <a href="{:url('cms/index/index',['tag_id'=>$tag['term_id']])}">
                        {$tag.name}
                    </a>
                {/volist}
            </div>
        </li>
    </ul>
</div>
{/block}

{block name="script"}
<script type="text/javascript">

</script>
{/block}
